/****************************************************************************
**
**	$Header: $
**
**	Description : 
**
**		XML-based application profile storage, based on code published by 
**		Emilio Guijarro Cameros at www.codeproject.com
**
****************************************************************************/
#ifndef	H_XMLPROFILE
	#define H_XMLPROFILE	__TIMESTAMP__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#	pragma once
#endif

#define _CRT_SECURE_NO_WARNINGS

#include <windows.h>
#include <msxml.h>
#include <comutil.h>
#include <shlobj.h>
#include <stdio.h>
/*	----------------------------------------------------------------------
	CXMLProfile class interface -- see XMLProfile.cpp for implementation
	----------------------------------------------------------------------	*/
class CXMLProfile
	{
/*
**	Instance Variables
*/
protected:
	IXMLDOMDocument *	m_pXMLDoc;
	_bstr_t				m_bstrFile;
/*
**	Methods
*/
	IXMLDOMNode *		getEntry(LPCTSTR, LPCTSTR);
	IXMLDOMNode *		getSection(LPCTSTR);

public:
	bool				Put(LPCTSTR, LPCTSTR, int);
	bool				Put(LPCTSTR, LPCTSTR, RECT &);
	bool				Put(LPCTSTR, LPCTSTR, LPCTSTR);
	
	int					Get(LPCTSTR, LPCTSTR, int nDefault = 0);
	RECT &				Get(LPCTSTR, LPCTSTR, RECT &, RECT * prDefault = NULL );
	LPSTR				Get(LPCTSTR, LPCTSTR, LPSTR, UINT, LPCSTR pstrDefault = "");

	bool				Save()
							{ 
							return (m_pXMLDoc != NULL && 
									SUCCEEDED(m_pXMLDoc->save(_variant_t(m_bstrFile)))); 
							}

	bool				Load(LPCTSTR);	
//
//	CTOR/DTOR
//
						CXMLProfile(LPCTSTR);

						~CXMLProfile(void)
							{ if (m_pXMLDoc) m_pXMLDoc->Release(); }

	};
#endif	// H_XMLPROFILE
/****************************************************************************
**
**	$History: XMLProfile.h $
**
**	-------------------------------------------------------------------------
**
**	End of XMLProfile.h
**
****************************************************************************/
